package com.xxxx.server.service.impl;

import com.xxxx.server.mapper.EmployeeMapper;
import com.xxxx.server.pojo.SalaryEmployee;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 员工账套模块
 */
@Service
public class EmployeeSalaryServiceIml {
    @Resource
    private EmployeeMapper employeeMapper;

    /**
     * 分页查询员工账套数据
     * @param currentPage
     * @param size
     * @return
     */
    public Map<String, Object> selectSalaryEmployeePage(Integer currentPage, Integer size) {
        if (currentPage != null && size != null) {
            currentPage = (currentPage - 1) * size;
        }
        //查询员工账套数据
        List<SalaryEmployee> list = employeeMapper.selectSalaryEmployee(currentPage, size);
        //统计数据
        int total = employeeMapper.getEmployeeTotal();
        //返回的Map集合数据
        Map<String, Object> map = new HashMap<>();
        map.put("data",list);
        map.put("total", total);
        
        return map;
    }

    /**
     * 修改更新员工账套所属工资账套
     * @param eid
     * @param sid
     * @return
     */
    public int updateSalaryEmployee(Integer eid,Integer sid) {
        return employeeMapper.updateSalaryEmployee(eid,sid);
    }
}
